{% macro gen_table(clients) %}
    <table id="demand-info-table" class="table table-bordered table-hover table-condensed table-striped">
        <thead>
            <tr>
                <th>用户ID</th>
                <th>手机号</th>
                <th>用户昵称</th>
                <th>来源</th>
                <th>推广</th>
                <th>sem计划</th>
                <th>sem单元</th>
                <th>sem关键词</th>
                <th>最后访问时间</th>
                <th>处理时间</th>
                <th>处理人</th>
                <th>结果</th>
            </tr>
        </thead>
        <tbody>
            {% for client in clients %}
            <tr>
                <td>{{ client.client.id }}</td>
                <td>{{ client.client.mobile | encrypt }}&nbsp;&nbsp;<span class="badge">{{ client.visit_cnt }}</span></td>
                <td>
                    {{ client.client.nickname }}&nbsp;&nbsp;
                    {% if client.client.gender == 0 %}
                        <i class="fa fa-venus fa-fw"></i>
                    {% else %}
                        <i class="fa fa-mars fa-fw"></i>
                    {% endif %}
                </td>
                <td>{{ client.demand_client_source_display }}</td>
                <td>{{ client.sem_path }}</td>
                <td>{{ client.demand.sem_plan }}</td>
                <td>{{ client.demand.sem_unit }}</td>
                <td>{{ client.demand.sem_keyword }}</td>
                <td>{{ client.last_visit_time }}</td>
                <td>{{ client.operate_time_display or '-' }}</td>
                <td>{{ client.operator.nickname or '-' }}</td>
                <td>{{ client.operate_result_display or '-' }}</td>
            </tr>
            {% endfor %}
        </tbody>
    </table>
{% endmacro %}
